<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>

<%
	//test push
	String cookieName = "AirportUser";
	Cookie cookies[] = request.getCookies();
	String username = null;
	if (cookies != null) {
		for (int i = 0; i < cookies.length; i++) {
			if (cookies[i].getName().equals(cookieName)) {
				username = cookies[i].getValue();
				break;
			}
		}
	}
%>
	<title>Airport Traveler App | CSE 5911 Project AU12</title>
 <!--[if IE]>
	<link rel="stylesheet" type="text/css" href="ie.css" />
	
<![endif]-->
	

<link rel="stylesheet" media="screen and (min-device-width: 800px)" href="full_style.css" />
<link rel='stylesheet' media='screen and (min-width: 300px) and (max-width: 799px)' href='mobile_style.css' />
<html>
	<center>
  
<header> 
<![if ! IE]>

<table width="100%">
		<tr>
		<td width="35%"><a href="<s:url action = "index"/>"><img width="100%" src="images/logo.png" border="0"></a></td>

		<td width="65%"><p align="right">
		<table><tr>
		<td><a href="<s:url action="flightTimes"/>"><img width="100%" src="images/flight_times.png" border="0"></a><br><a href="<s:url action="terminalMap"/>"><img width="100%" src="images/terminal_maps.png" border="0"></a></td>
		
		</tr></table>
		</p>
		</td>
		</tr>

		<tr><td valign="top">
		<% if (username != null) { %>
		Hello, <a href="<s:url action="viewprofile"/>"><s:property value="username"/></a> ! 
		<%;} else { %>
		You are not logged in. <a href="signup.jsp">Log in.</a> | <a href="signup.jsp">Click Here to Signup!</a>
		<%;} %>
		</td><td align="right">
	
		 <%if (username != null) { %> <a href="logout">Logout</a> <%; } %>
		</tr></td></table> 
		</p>
<![endif]>

 <!--[if IE]>
		<table width="100%" style="background-color: #80B2FF;">
		<tr>
		<td width="35%"><a href="<s:url action = "index"/>"><img src="images/logo.png" border="0"></a></td>

		<td width="65%"><p align="right">
		<table><tr>
		<td><a href="flight_times.jsp"><img src="images/flight_times.png" border="0"></a><br><a href="terminal_maps.jsp"><img src="images/terminal_maps.png" border="0"></a></td>
		
		</tr></table>
		</p>
		</td>
		</tr>

		<tr><td valign="top">
		<% if (username != null) { %>
		Hello, <a href="<s:url action="viewprofile"/>"><s:property value="username"/></a> ! 
		<%;} else { %>
		You are not logged in. <a href="signup.jsp">Log in.</a> | <a href="signup.jsp">Click Here to Signup!</a>
		<%;} %>
		</td><td align="right">
	
		 <%if (username != null) { %> <a href="logout">Logout</a> <%; } %>
		</tr></td></table> 
		</p>

		
<![endif]-->
    
		
		
	</header>	

	
	<div>
        
        <table width="100%" bgcolor="white">
        <tr>
        	<td><s:property value = "threadTitle"/></td>
        </tr>
        </table>
        <table width="100%"><center>
        <tr>
        	<td>Created by:</td>
        	<td><% if (username != null) {%><a href="<s:url action = "checkprofile"><s:param name = "username"><s:property value="creator"/></s:param></s:url>"><%;} %><s:property value = "creator"/><%if (username != null) {%></a><%;} %></td>
        </tr>
        <tr>
        	<td>Date Created:</td>
        	<td><s:property value = "date"/></td>
        </tr>
        <tr>
        	<td>Total Posts:</td>
        	<td><s:property value = "count"/></td>
        </tr>
        </table>
        <table width = "100%">
        <tr>
        	<td><s:property value = "threadContent"/></td>
        </tr>
        <s:iterator value="posts">
        <tr bgcolor="#d6d6d6"><td><% if (username != null) {%><a href="<s:url action = "checkprofile"><s:param name = "username"><s:property value="userName"/></s:param></s:url>"><%;} %><s:property value = "userName"/><%if (username != null) {%></a><%;} %></td><td><s:property value="postDate"/></td></tr>
        <tr><td><s:property value="postText"/></td></tr>
        </s:iterator>
        <%if (username != null) { %>
        <s:form action="replythread">
        	<tr>
        	<s:textarea name = "comments" cols="35" rows="5"></s:textarea>
        	</tr>
        	<tr>
        	<s:hidden name="threadId"></s:hidden>
        	</tr>
        	<tr>
        	<s:submit value="Submit"/>
        	</tr>
        </s:form>
        
        <%;} %>
        </center>
        </table>
        
	</div>
<footer>
	<font size="1">
	<a href="user_guide.jsp">Help</a>| Copyright 2012
	</font>
	
	</footer>
	</center>
</html>